<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>合同添加或编辑界面</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
    <style>
        .w440{
            width: 440px !important;
        }
    </style>
</head>
<body>
<div class="page-content-wrap clearfix">
    <form class="layui-form" id="tool">
        <div class="layui-tab">
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <input type="hidden" name="applyId" id="applyId" value="${wbContract.applyId}" />
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;合同名称：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="name" value="${wbContract.name}" lay-verify="required" placeholder="请输入合同名称" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;合同编号：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="num" value="${wbContract.num}" lay-verify="required" placeholder="请输入合同编号" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;供货商：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="supplier" value="${wbContract.supplier}" lay-verify="required" placeholder="请输入供货商" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;价格：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="price" value="${wbContract.price}" lay-verify="required|number" placeholder="请输入价格" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;合同内容：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="content" value="${wbContract.content}" lay-verify="required" placeholder="请输入合同内容" autocomplete="off"
                                   class="layui-input" maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label"><span class="red">*</span>签订日期：</label>
                            <div class="layui-input-inline w440 marr50">
                                <input type="text" name="signDate" id="signDate" value="<#if wbContract.signDate??>${wbContract.signDate?string('yyyy-MM-dd')}</#if>" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label"><span class="red">*</span>到期日期：</label>
                            <div class="layui-input-inline w440 marr50">
                                <input type="text" name="endDate" id="endDate" value="<#if wbContract.endDate??>${wbContract.endDate?string('yyyy-MM-dd')}</#if>" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="margin-left: 0px !important;text-align: center">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="submitBtn">提交</button>
                <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                <button type="button" style="display: none;" id="save" class="layui-btn layui-btn-primary"></button>
            </div>
        </div>
    </form>
</div>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'form', 'baseutil','laydate'], function () {
        var $ = layui.jquery,
            form = layui.form,
            laydate = layui.laydate,
            baseutil = layui.baseutil;

        laydate.render({
            elem: '#signDate', //指定元素
            type: 'date'
            ,trigger: 'click'
        });
        laydate.render({
            elem: '#endDate', //指定元素
            type: 'date'
            ,trigger: 'click'
        });

        //监听提交
        form.on('submit(submitBtn)', function (data) {
            data.field.id = '${wbContract.id}';
            baseutil.post("/work/wb/wbcontract/addOrUpdate", data.field, function () {
                $("#save").click();
            });
            return false;
        });
    });
</script>
</body>
</html>